from flask import Flask

from flask import render_template

app = Flask(__name__)

@app.route("/type/")
def type():
    result = """
    <ul>
        <li><a href="/type/novel/">小说</a></li>
        <li><a href="/type/fairy_tale/">童话</a></li>
        <li><a href="/type/magazine/">杂志</a></li>
        <li><a href="/type/cartoon/">漫画</a></li>
        <li><a href="/type/education/">教辅工具</a></li>
    </ul>
    """
    return result
@app.route("/type/novel/")
def novel():
    book_list = [
                 {"book_type": "《鬼吹灯》", "author": "天下霸唱","book_leixing": "玄幻灵异"},
                 {"book_type": "《盗墓笔记》", "author": "南派三叔","book_leixing": "灵异恐怖"},
                 {"book_type": "《斗破苍穹》", "author": "天蚕土豆","book_leixing": "玄幻魔法"},
                 {"book_type": "《莽荒纪》", "author": "我吃西红柿","book_leixing": "武侠修真"},
                 {"book_type": "《心理罪》", "author": "不是何阳","book_leixing": "侦探推理"}]
    return render_template("index.html",**locals())
@app.route("/type/fairy_tale/")
def fairy_tale():
    book_list = [
                {"book_type": "《安徒生童话》", "author": "安徒生", "book_leixing": "童话"},
                {"book_type": "《丑小鸭》", "author": "安徒生", "book_leixing": "童话"},
                {"book_type": "《皮皮鲁和鲁西西》", "author": "郑渊洁", "book_leixing": "童话"},
                {"book_type": "《灰姑娘》", "author": "格林兄弟", "book_leixing": "童话"},
                {"book_type": "《白雪公主》", "author": "格林兄弟", "book_leixing": "童话"}]
    return render_template("index.html",**locals())
@app.route("/type/magazine/")
def magazine():
    book_list = [
                {"book_type": "《财富》", "author": "财富出版社", "book_leixing": "财经管理类"},
                {"book_type": "《读者》", "author": "读者出版社", "book_leixing": "文摘类"},
                {"book_type": "《环球人文地理》", "author": "环球人文地理出版社", "book_leixing": "人文科普类"},
                {"book_type": "《商界·时尚》", "author": "商界·时尚出版社", "book_leixing": "娱乐时尚类"},
                {"book_type": "《女报·时尚》", "author": "女报·时尚出版社", "book_leixing": "生活情感类"}]
    return render_template("index.html",**locals())
@app.route("/type/cartoon/")
def cartoon():
    book_list = [
                {"book_type": "《天空之城》", "author": "宫崎骏", "book_leixing": "日漫"},
                {"book_type": "《千与千寻》", "author": "宫崎骏", "book_leixing": "日漫"},
                {"book_type": "《龙猫》", "author": "宫崎骏", "book_leixing": "日漫"},
                {"book_type": "《姜子牙》", "author": "饺子", "book_leixing": "国漫"},
                {"book_type": "《哪吒之魔童降世》", "author": "饺子", "book_leixing": "国漫"}]
    return render_template("index.html",**locals())
@app.route("/type/education/")
def education():
    book_list = [
                {"book_type": "《计算机基础》", "author": "同济大学出版社", "book_leixing": "理科"},
                {"book_type": "《五年高考三年模拟》", "author": "清华大学出版社", "book_leixing": "文科"},
                {"book_type": "《软件开发》", "author": "北京大学出版社", "book_leixing": "理科"},
                {"book_type": "《毛概》", "author": "复旦大学出版社", "book_leixing": "文科"},
                {"book_type": "《企业财务管理》", "author": "同济大学出版社", "book_leixing": "文科"}]
    return render_template("index.html",**locals())

if __name__ == '__main__':
    app.run(
        # host='10.20.30.40',
        # port=1093,
        # debug=True
    )